package com.example.mform.service.impl;

import com.example.mform.entity.Choice;
import com.example.mform.entity.Question;
import com.example.mform.repository.FillFormRepository;
import com.example.mform.repository.QuestionRepository;
import com.example.mform.repository.UserFormRepository;
import com.example.mform.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shishuqian
 * date 2020/12/17
 * time 0:49
 **/
@Service
public class QuestionServiceImpl implements QuestionService {

    @Autowired
    private QuestionRepository questionRepository;

    @Override
    public List<Question> findAll() {
        return questionRepository.findAll();
    }

    @Override
    public Question findById(Long id) {
        return questionRepository.findById(id).get();
    }

    @Override
    public void save(Question question) {
        questionRepository.save(question);
    }

    @Override
    public void update(Question question) {
        questionRepository.save(question);
    }

    @Override
    public void deleteById(Long id) {
        questionRepository.deleteById(id);
    }


}
